package main
import "fmt"
import "io"
import "os"
func main(){
	list:=os.Args
	if len(list)!=3{
	fmt.Println("usage:xxx srcFile dstFile")
	return
	}
	srcFile=list[1]
	dstFile=list[2]
	if srcFile==dstFile{
		fmt.Println("对不起,源文件和目标文件相同")
		return
	}
	sf,err1=os.Open(srcFile)
	if err1!=nil{
		fmt.Println("err1=",err1)
		return
	}
	df,err2:=os.Create(srcFile)
	if err2!=nil{
		fmt.Println("err2=",err2)
		return
	}
	defer sf.Close()
	defer df.Close()
	buf:=make([]byte 4*1024)
	for{
		n,err:=sf.Read(buf)
		if err!=nil{
			if err==io.EOF{
				break
			}
			fmt.Println("reading error")
		}
		df.Write(buf[:n])
	}
	defer buf.Close()
}